package com.memory.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableDiscoveryClient
@Slf4j
public class ClientApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext ctx = SpringApplication.run(ClientApplication.class, args);

        long start = System.currentTimeMillis();

        long time = (System.currentTimeMillis() - start) / 1000;
        String info = "启动完成，耗时%d秒，swagger访问链接：http://%s:%s%s/doc.html";
        String address = ctx.getEnvironment().getProperty("server.address");
        String port = ctx.getEnvironment().getProperty("server.port");
        String path = ctx.getEnvironment().getProperty("server.servlet.context-path");
        log.info(String.format(info, time, address, port, path));
    }
}
